﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;

namespace DIProject.Util.Login
{
    public class CheckLogin
    {
        public static bool Check(out string result)
        {
            string conStr = Properties.Settings.Default.DIAptekaConnectionString;
            try
            {
                using (SqlConnection connection = new SqlConnection(conStr))
                {
                    connection.Open();
                    if (connection.State != System.Data.ConnectionState.Open)
                    {
                        throw new Util.DIException("Ошибка авторизации");
                    }
                }
                result = "Все нормально";
                return true;
            }
            catch (Exception ee)
            {
                result = ee.Message;
                return false;
            }
        }
    }
}
